package com.gagakuai.bpm.demo.messageEvent.business;

import lombok.extern.slf4j.Slf4j;
import org.camunda.bpm.engine.TaskService;
import org.camunda.bpm.engine.delegate.DelegateExecution;
import org.camunda.bpm.engine.delegate.JavaDelegate;
import org.camunda.bpm.engine.task.Task;
import org.springframework.stereotype.Component;

import java.util.List;

/*
 * @program: bpm_server
 * @description:
 * @author: houhong
 * @create: 2022-07-21 20:03
 */
@Slf4j
@Component(value = "businessDelagte")
public class BusinessDelagte implements JavaDelegate {


    @Override
    public void execute(DelegateExecution delegateExecution) throws Exception {


        TaskService taskService = delegateExecution.getProcessEngineServices()
                .getTaskService();


        List<Task> list = taskService.createTaskQuery().list();

        for (Task task : list) {

            log.info("#task:{},taskConent:{}#", task.getId(), task.getName());
        }


    }
}